package com.yjtravel.strategy;

/**
 * 返现
 * @author 28336
 * @version 1.0
 * Create by 2024/3/29 9:42
 */
public class CashReturn extends CashSuper{

    //返利条件
    private double moneyCondition = 0D;

    //返现金额
    private double moneyResult = 0D;

    public CashReturn(double moneyCondition, double moneyResult) {
        this.moneyCondition = moneyCondition;
        this.moneyResult = moneyResult;
    }

    @Override
    public double acceptCash(double price, double num) {
        double result = price * num;
        if(moneyResult >0 && result >= moneyResult){
            result = result - moneyResult;
        }
        return result;
    }
}
